home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / prolog / modprolg / mod-prol.lha / Prolog / modlib / src / $bio.P < prev    next >
Encoding:
Text File  |  1992-05-11  |  3.6 KB  |  124 lines

  1. /************************************************************************
  2. *                                    *
  3. * The SB-Prolog System                            *
  4. * Copyright SUNY at Stony Brook, 1986; University of Arizona, 1987    *
  5. *                                    *
  6. ************************************************************************/
  7.  
  8. /*-----------------------------------------------------------------
  9. SB-Prolog is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY.  No author or distributor
  11. accepts responsibility to anyone for the consequences of using it
  12. or for whether it serves any particular purpose or works at all,
  13. unless he says so in writing.  Refer to the SB-Prolog General Public
  14. License for full details.
  15.  
  16. Everyone is granted permission to copy, modify and redistribute
  17. SB-Prolog, but only under the conditions described in the
  18. SB-Prolog General Public License.   A copy of this license is
  19. supposed to have been given to you along with SB-Prolog so you
  20. can know your rights and responsibilities.  It should be in a
  21. file named COPYING.  Among other things, the copyright notice
  22. and this notice must be preserved on all copies. 
  23. ------------------------------------------------------------------ */
  24.  
  25. /****************************************************************************
  26.  *                                                                          *
  27.  * This file has been changed by to include Modules Extensions              *
  28.  * Changes by : Brian Paxton 1991/92                                        *
  29.  * Last update : June 1992                                                  *
  30.  *                                                                          *
  31.  * Organisation : University of Edinburgh.                                  *
  32.  * For : Departments of Computer Science and Artificial Intelligence        * 
  33.  *       Fourth Year Project.                                               *
  34.  *                                                                          *
  35.  ****************************************************************************/
  36.  
  37. /* $bio.P */
  38.  
  39. $bio_export([$writename/1,$writeqname/1,$put/1,$nl/0,$tab/1,
  40.     $tell/1,$tell/2,$telling/1,$told/0,$get/1,$get0/1,$see/1,$seeing/1,
  41.     $seen/0,$write4/1]).
  42.  
  43. % $bio_use : $modules
  44.  
  45. % $writename/1
  46. % Drop tag before printing argument.
  47.  
  48. $writename(Arg) :-
  49.     ( $atom(Arg) ; $structure(Arg) ),
  50.     $functor0(Arg, X),
  51.         $dismantle_name(X,Y,Tag),
  52.     $isa_structuretag(Tag),
  53.     $writename0(Y),!.
  54.  
  55. $writename(X) :- $writename0(X).
  56.  
  57. $writename0(T) :- '_$builtin'(133).
  58.  
  59. % $writeqname/1
  60. % Drop tag before printing argument.
  61.  
  62. $writeqname(Arg) :-
  63.     ( $atom(Arg) ; $structure(Arg) ),
  64.     $functor0(Arg, X),
  65.         $dismantle_name(X,Y,Tag),
  66.     $isa_structuretag(Tag),
  67.     $writeqname0(Y),!.
  68.  
  69. $writeqname(X) :- $writeqname0(X).
  70.  
  71. $writeqname0(P) :- '_$builtin'(130).
  72.  
  73. $put(N) :-
  74.     integer(N) ->
  75.         $put0(N) ;
  76.         ( $writename('*** Error: noninteger argument to put/1: '),
  77.           $write(N),
  78.           $nl).
  79.  
  80. $put0(N) :- '_$builtin'(24).
  81.  
  82. $nl :- $put(10).
  83.  
  84. $tab(N) :-
  85.     integer(N) ->
  86.         $tab0(N) ;
  87.         ( $writename('*** Error: noninteger argument to tab/1: '),
  88.           $write(N),
  89.           $nl).
  90.  
  91. $tab0(N) :- '_$builtin'(25).
  92.  
  93. $tell(D) :-
  94.     $atom(D) ->
  95.         $tell(D,0) ;
  96.         ( $writename('*** Error: nonatom argument to tell/1'),
  97.           $nl).
  98.  
  99. $tell(D,Openflag) :- '_$builtin'(33).
  100.  
  101. $telling(F) :- '_$builtin'(34).
  102.  
  103. $told :- '_$builtin'(35).
  104.  
  105.  
  106. $get(N) :- '_$builtin'( 19 ).
  107.  
  108. $get0(N) :- '_$builtin'( 18 ).
  109.  
  110. $see(F) :- 
  111.     $atom(F) -> 
  112.         $see0(F) ; 
  113.         ( $writename('*** Error: nonatom argument to see/1'),
  114.           $nl).
  115.  
  116. $see0(F) :- '_$builtin'(30).
  117.  
  118. $seeing(F) :- '_$builtin'(31).
  119.  
  120. $seen :- '_$builtin'(32).
  121.  
  122. $write4(X) :- '_$builtin'(59).
  123.  
  124.